# -*- coding: utf-8 -*-
#Importamos funciones standars
import datetime
from django.shortcuts import render_to_response

#importamos nuestros propios modulos
from salones.clientes.models import Clientes
from models import Servicios, Turnos
from formularios import Fservicio, Fturno
from clases import Semana

# Create your views here.
def Vmenu(request):
	return render_to_response('turnos/menu.html', {'fecha':datetime.date.today()},)

def Vservices(request):
	if request.method == 'POST': pass #Se esta realizando una busqueda de clientes (Filtrar, clientes)
	else: S = Servicios.objects.all()
	return render_to_response('listado.html',{'subject':"Clientes",'elementos':S,},)

def Vnuevo_service(request):
	if request.method == 'POST':
		if Fservicio(request.POST).is_valid():
			Fservicio(request.POST).save()
			return render_to_response('save.html', {'accion': 'Creacion de cliente'})
		else: return render_to_response('form.html',{'form':Fservicio(request.POST),'title':"Crear Cliente"},)
	else: return render_to_response('form.html',{'form':Fservicio(),'title':"Crear Cliente"},)

def Vagenda(request,d, m, y):
	S = Semana(datetime.datetime(int(y),int(m),int(d)))
	return render_to_response('turnos/agenda.html',{'week':S},)